//
//  MyFirstTableViewViewController.m
//  MyFirstTableView
//
//  Created by wilson_chen on 2010/1/5.
//  Copyright __MyCompanyName__ 2010. All rights reserved.
//

#import "MyFirstTableViewViewController.h"

@implementation MyFirstTableViewViewController

@synthesize tableCellList;
@synthesize tableIdentifier;

- (void)viewDidLoad {
    NSMutableArray *array = [[NSMutableArray alloc] initWithObjects:
							 @"A", @"B", @"C", @"D", @"E", @"F", @"G", @"H", nil];
    self.tableCellList = array;
    self.tableIdentifier = @"FirstTable";
    [array release];
    [super viewDidLoad];
}

- (NSInteger)tableView:(UITableView *)tableView 
 numberOfRowsInSection:(NSInteger)section
{
    return [self.tableCellList count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView 
         cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:
                             self.tableIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
                                       reuseIdentifier: self.tableIdentifier] autorelease];
    }
    
    NSUInteger row = [indexPath row];
    cell.textLabel.text = [tableCellList objectAtIndex:row];
    return cell;
}
- (void)didReceiveMemoryWarning {
	// Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
	
	// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
	// Release any retained subviews of the main view.
	// e.g. self.myOutlet = nil;
    self.tableCellList = nil;
    [super viewDidUnload];
}
- (void)dealloc {
    [tableCellList release];
    [super dealloc];
}
@end
